package org.rednebula.simple.model.model;

import org.rednebula.framework.core.IEnvironment;
import org.rednebula.framework.core.model.State;
import org.rednebula.framework.core.model.domain.BasicModel;
import org.rednebula.simple.model.eo.Person;
import org.springframework.stereotype.Component;

@Component
public class PersonModel  extends BasicModel {
	

	private Person person;
    
	String name;
	String sex;
	String education;
	
	
	public PersonModel() {
		super();
	}

	public PersonModel(State state) {
		super(state);
		// TODO Auto-generated constructor stub
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getEducation() {
		return education;
	}

	public void setEducation(String education) {
		this.education = education;
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}
	public void create(IEnvironment env) {
		Person	person=new Person();
		person.setEducation(this.getEducation());
		person.setIdent((String)getIdent());
		person.create(env);
       this.setPerson(person);
	}
	
	@Override
	public void modify(IEnvironment env) {
		if(this.isModified()){
			this.getPerson().setEducation(this.getEducation());
			this.getPerson().setName(this.getName());
			this.getPerson().setSex(this.getSex());
			this.getPerson().modify(env);
		}
	}
}
